import request from "../axios";
import { Base64 } from "js-base64";
export const loginByUsername = (
    tenantId,
    username,
    password,
    type,
    key,
    code
) =>
    request({
        url: "/api/blade-auth/oauth/token",
        method: "post",
        headers: {
            "Tenant-Id": tenantId,
            "Dept-Id": false,
            "Role-Id": false,
            "Captcha-Key": key,
            "Captcha-Code": code,
            Authorization: `Basic ${Base64.encode(`saber:saber_secret`)}`
        },
        params: {
            tenantId,
            username,
            password,
            grant_type: "password",
            scope: "all",
            type
        }
    });

export const getSelectAllList = (params) => {
    return request({
        url: "/api/blade-system/dept/site-select",
        method: "get",
        params
    });
};

export const logout = () =>
    request({
        url: "/api/blade-auth/oauth/logout",
        method: "get"
    });
